﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test.aspx.vb" Inherits="WebPhonebook.Test" EnableEventValidation="true"%>
<%@ PreviousPageType VirtualPath="Popup.aspx" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:Label ID="User" runat="server" Text="Label"></asp:Label>
        <br />
        <br />
        <br />
    
        <asp:TextBox ID="TextBox1" runat="server" TextMode="Password"></asp:TextBox>
        TEXTMODE = PASSWORD<br />
        <br />
        <asp:TextBox ID="TextBox2" runat="server" AutoCompleteType="Company"></asp:TextBox>
        AUTOCOMPLETE = COMPANY<br />
        <br />
        <asp:TextBox ID="TextBox3" runat="server" mask = "(999)-999-9999"></asp:TextBox>
    
        Mask = (999)-999-9999<br />
        <br />
        <asp:ListBox ID="ListBox1" runat="server" SelectionMode="Multiple">
            <asp:ListItem>One</asp:ListItem>
            <asp:ListItem>Two</asp:ListItem>
            <asp:ListItem>Three</asp:ListItem>
        </asp:ListBox>
        <br />
        <br />
        <input id="Submit1" type="submit" value="JS Confirm" onclick="return Submit1_onclick()" /><br />
        <br />
        <asp:Button ID="Button1" runat="server" Text="HTTP Response" />
    
        &nbsp;<asp:Label ID="Label1" runat="server"></asp:Label>
    
        <br />
        <br />
        <asp:Button ID="Button2" runat="server" Text="HTTP Response File" OnClick = "Button2_Click" />
        <br />
        <br />
        <asp:Button ID="Insert" runat="server" Text="Insert Record" />
&nbsp;
        <asp:Label ID="Label2" runat="server" ForeColor="Red"></asp:Label>
        <br />
        <br />
        <br />
        ZIP<asp:TextBox ID="ZipTextBox" runat="server">30329</asp:TextBox>
        <asp:HiddenField ID="OldZipHiddenField" runat="server" />
        <br />
        <input id="Postback" type="button" value="Save" onclick="return Postback_onclick()" />
        <asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>
        <br />
        <asp:Button ID="Save" runat="server" Text="Button" Visible="False" />
        <br />
        <br />
        <asp:Button ID="Button4" runat="server" Text="GetCookie" />
        <asp:Label ID="SessionID" runat="server"></asp:Label>
        <br />
        <br />
        <br />
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        <Services>
        <asp:ServiceReference Path = "~/WebServices/POE.asmx"/>
        </Services>
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                There are
                <asp:Label ID="countLabel" runat="server" Text="#"></asp:Label>
                &nbsp;contacts in total.<br /> The first entry is for:
                <asp:Label ID="lnameLabel" runat="server" Text="lname"></asp:Label>
                ,
                <asp:Label ID="fnameLabel" runat="server" Text="fname"></asp:Label>
                <br />
                <asp:GridView ID="GridView1" runat="server">
                </asp:GridView>
                <asp:Button ID="Button3" runat="server" Text="Refresh" />
            </ContentTemplate>
        </asp:UpdatePanel>
        <br />
        <br />
        <br />
        <asp:HiddenField ID="HiddenField1" runat="server" />
        <br />
    </div>
    <script type="text/javascript">
        function setBoolean(r) {
            var hidden = $get('HiddenField1');
            if (r == true)
                hidden.Value = "true";
            else
                hidden.Value = "false";
        }

        function Postback_onclick() {
            
            var newZip = $get('ZipTextBox').value;
            var oldZip = $get('OldZipHiddenField').value;
            //Call Web Service ComparePOE defined in WebServices\POE.asmx
            //ComparePOE is registered in ScriptManager
            WebPhonebook.POE.ComparePOE(oldZip, newZip, UserConfirm);
            //UserConfirm is the callback function for web service ComparePOE         

        }

        function UserConfirm(result) {
            if (result) {
                if (confirm("Are you sure you want to save?"))
                    __doPostBack('Save', '');
                    //__doPostBack function triggers the click event handler for a button (id = Save) on the server side
            }
        }
        function Submit1_onclick() {
        return confirm("Are you sure you want to submit?")
        }

    </script>
    </form>
</body>
</html>
